Re: [SQL] uncorrelated subqueries - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] uncorrelated subqueries
Date
Msg-id l03130305b3ae5b9cac2f@[147.233.159.109]
Whole thread Raw
In response to Re: [SQL] uncorrelated subqueries  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
At 22:30 +0300 on 08/07/1999, Tom Lane wrote:


> The main problem that would have to be solved to convert this to
> an InitPlan is what to do if the subselect returns a huge number
> of tuples ... with the current implementation, since we scan the
> tuples one at a time, there's no problem, but if we try to store
> all the tuples we could run out of memory.

How about putting them in a temporary table if the number of returned
tuples is big? Although the scan on the temp table will be sequential, it's
still not the same as scanning the original table (checking conditions and
perhaps even joining). If the internal query is ran on a 3 million record
table, and returns a million of them, it's worthwhile storing in a temp
table.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




pgsql-sql by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [SQL] Bad date representation
Next
From: Tom Lane
Date:
Subject: Re: [SQL] Re: [HACKERS] SELECT DISTINCT question